<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="./css/default.css"/>
    <link rel="stylesheet" href="./js/datepicker/jquery-ui.css">
    <link rel="stylesheet" href="./css/common.css"/>
    <link rel="stylesheet" href="./css/linggong.css"/>
    <link rel="stylesheet" href="./js/pagination/paging.css"/>
    <title>零工市场-接单详情</title>
</head>
<body>
<div class="dlg-content">
    <div class="dlg-jiedan-box">
        <div class="dlg-row">
            <div class="dlg-row-8 clear-padding">
                <div class="dlg-list-title">
                    <h3 class="font-16">保洁阿姨</h3>&nbsp;
                    <i class="dlg-icon-bao"></i>
                    <i class="dlg-icon-daili"></i>&nbsp;
                    <span class="dlg-tag">家政保洁</span>
                    <span class="dlg-tag">计时</span>
                </div>
                <div>
                    <span class="dlg-red-color">20</span>&nbsp;元/小时
                </div>
                <div class="dlg-jiedan-prograssB">
                    <label>待招人数</label>&nbsp;
                    <label id="dzrs" class="dlg-box"></label>
                    (4/10)
                </div>
                <div>
                    <label>干活地址：</label>
                    <span>上海普陀区真北路958号1号楼7楼</span>
                </div>
            </div>
            <div class="dlg-row-2 dlg-jiedan-logo">
                <img src="images/logo.png" alt="">
                <div>
                    上海打零工互联网科技有限公司
                </div>
            </div>
        </div>

        <div class="detail">
            <label>详情描述：</label>
            <div>上海普陀区真北路958号1号楼7楼上海普陀区真北路958号1号楼7楼上海普陀区真北路958号1号楼7楼上海普陀区真北路958号1号楼7楼</div>
        </div>
        <div>
            <label>图片展示：</label>
            <img src="images/orderD.png" draggable="false" alt="">
        </div>
        <div class="title">代理商服务信息</div>
        <div>
            <label>转单</label>
            <span>代理商1111111</span>
        </div>
        <div>
            <label>差价</label>
            <span>5元/小时/人</span>
        </div>
        <div>
            <label>接单利润</label>
            <span>2元/小时/人</span>
        </div>
        <div>
            <label>给雇员报酬</label>
            <span>15元/小时/人</span>
        </div>
        <div>
            <label>下级代理商</label>
            <span>代理商222222</span>
            <span>代理商222222</span>
            <span>代理商222222</span>
        </div>
        <div>
            <label>&nbsp;&nbsp;</label>
            <button type="button" class="btn btn-warning-o">接单</button>
        </div>
    </div>
</div>
<script src="./js/pagination/paging.js"></script>
<script>
    var id =sessionStorage.getItem("jobId");
    $(function () {
        $.ajax({
            url: url+'/job/'+id,
            contentType: "application/json; charset=utf-8",
            type: 'get',
            dataType: 'json',
            timeout: '1000',
            cache: 'false',
            error: function () {
                alert('报错')
            },
            success:function (data) {
                if(data.status==200&&data.body.code=="SUCCESS"&&data.body.data!=""){
                    var vo=data.body.data;
                    var html="  <div class=\"dlg-jiedan-box\">\n" +
                        "        <div class=\"dlg-row\">\n" +
                        "            <div class=\"dlg-row-8 clear-padding\">\n" +
                        "                <div class=\"dlg-list-title\">\n" +
                        "                    <h3 class=\"font-16\">"+vo.task_title+ "</h3>&nbsp;\n" +
                        "                    <i class=\"dlg-icon-bao\"></i>\n" +
                        "                    <i class=\"dlg-icon-daili\"></i>&nbsp;\n" +
                        "                    <span class=\"dlg-tag\">"+vo.post_type_name+"</span>\n" +
                        "                    <span class=\"dlg-tag\">"+vo.cost_accounting_type_name+"</span>\n" +
                        "                </div>\n" +
                        "                <div>\n";
                    if(vo.cost_accounting_type==1){
                        html+="                    <span class=\"dlg-red-color\">"+vo.price_wage+"</span>&nbsp;"+vo.job_meter_unit_wage_name+"\n";
                    }else if(vo.cost_accounting_type==2){
                        html+="                    <span class=\"dlg-red-color\">"+vo.price_commission+"</span>&nbsp;"+vo.job_meter_unit_commission_name+"\n";
                    }else if(vo.cost_accounting_type==3){
                        html+="                    <span class=\"dlg-red-color\">"+vo.price_wage+"</span>&nbsp;"+vo.job_meter_unit_wage_name+"\n";
                        html+="                    <span class=\"dlg-red-color\">"+vo.price_commission+"</span>&nbsp;"+vo.job_meter_unit_commission_name+"\n";
                    }

                    html+="                </div>\n" +
                        "                <div class=\"dlg-jiedan-prograssB\">\n" +
                        "                    <label>待招人数</label>&nbsp;\n" +
                        "                    <label id=\"dzrs\" class=\"dlg-box\"></label>\n" +
                        "                    ("+(vo.recruit_number-vo.surplus_recruit_number)+"/"+vo.recruit_number+")\n" +
                        "                </div>\n" +
                        "                <div>\n" +
                        "                    <label>干活地址：</label>\n" +
                        "                    <span>"+vo.work_address+"</span>\n" +
                        "                </div>\n" +
                        "            </div>\n" +
                        "            <div class=\"dlg-row-2 dlg-jiedan-logo\">\n" +
                        "                <img src=\"images/logo.png\" alt=\"\">\n" +
                        "                <div>\n" +
                        "                    上海打零工互联网科技有限公司\n" +
                        "                </div>\n" +
                        "            </div>\n" +
                        "        </div>\n" +
                        "\n" +
                        "        <div class=\"detail\">\n" +
                        "            <label>详情描述：</label>\n" +
                        "            <div>"+vo.task_description+"</div>\n" +
                        "        </div>\n" +
                        "        <div>\n" ;
                         if(vo.job_imgs){
                            html+="            <label>图片展示：</label>\n"
                            for(var i=0;i<vo.job_imgs.length;i++){
                                html+="            <img src=\""+vo.job_imgs[i].url+"\" draggable=\"false\" alt=\"\">\n";
                            }
                         }
                        html+="        </div>\n" +
                        "        <div class=\"title\">代理商服务信息</div>\n" +
                        "        <div>\n" +
                        "            <label>转单</label>\n" +
                        "            <span>代理商1111111</span>\n" +
                        "        </div>\n" +
                        // "        <div>\n" +
                        // "            <label>差价</label>\n" +
                        // "            <span>5元/小时/人</span>\n" +
                        // "        </div>\n" +
                        "        <div>\n" +
                        "            <label>接单利润</label>\n";
                        if(vo.cost_accounting_type==1){
                            html+="            <span>"+vo.wage_subordinate_money+vo.job_meter_unit_wage_name+"/人</span>\n";
                        }else if(vo.cost_accounting_type==2){
                            html+="            <span>"+vo.commission_subordinate_money+vo.job_meter_unit_commission_name+"/人</span>\n";
                        }else if(vo.cost_accounting_type==3){
                            html+="            <span>"+vo.wage_subordinate_money+vo.job_meter_unit_wage_name+"/人</span>\n";
                            html+="            <span>"+vo.commission_subordinate_money+vo.job_meter_unit_commission_name+"/人</span>\n";
                        }

                        html+="        </div>\n" +
                        // "        <div>\n" +
                        // "            <label>给雇员报酬</label>\n" +
                        // "            <span>15元/小时/人</span>\n" +
                        // "        </div>\n" +
                        // "        <div>\n" +
                        // "            <label>下级代理商</label>\n" +
                        // "            <span>代理商222222</span>\n" +
                        // "            <span>代理商222222</span>\n" +
                        // "            <span>代理商222222</span>\n" +
                        // "        </div>\n"
                        "        <div>\n" +
                        "            <label>&nbsp;&nbsp;</label>\n" +
                        "            <button type=\"button\" onclick=\"jiedan('"+vo.id+"')\" class=\"btn btn-warning-o\">接单</button>\n" +
                        "        </div>\n" +
                        "    </div>"
                    $(".dlg-content").html("").append(html);
                }
            }
        })
    })

    function jiedan(obj) {
        var json ={
            "userid":userid
        }
        if(obj!=""){
            $.ajax({
                url: url+'/job/'+obj+'/agentJob',
                contentType: "application/json; charset=utf-8",
                type: 'post',
                data:JSON.stringify(json),
                dataType: 'json',
                timeout: '1000',
                cache: 'false',
                error: function () {
                    alert('报错')
                },
                success: function (data) {
                    if(data.status==200&&data.body.code=="SUCCESS"){
                        var vo=data.body.data;
                        alert("接单成功")
                    }
                }
            })

        }
    }

</script>
</body>
</html>